package com.zhanghe.mall.service.vo;

import com.zhanghe.mall.pojo.AttributeProperty;
import com.zhanghe.mall.pojo.ClassificationAttribute;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.BeanUtils;

public class AttributePropertyVO {

  public String value;

  public Integer sort;

  public String getValue() {
    return value;
  }

  public void setValue(String value) {
    this.value = value;
  }

  public Integer getSort() {
    return sort;
  }

  public void setSort(Integer sort) {
    this.sort = sort;
  }

  public static AttributePropertyVO transform(AttributeProperty attributeProperty){
    AttributePropertyVO vo = new AttributePropertyVO();
    BeanUtils.copyProperties(attributeProperty,vo);
    return vo;
  }

  public static List<AttributePropertyVO> transform(List<AttributeProperty> attributePropertys){
    return attributePropertys.stream().map(attributeProperty -> {
      AttributePropertyVO vo = new AttributePropertyVO();
      BeanUtils.copyProperties(attributeProperty,vo);
      return vo;
    }).collect(Collectors.toList());
  }
}
